{include file='public/meta'}
<title>委托列表</title>
{css href='/static/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css'}
</head>
<body>
{include file='public/header'}
{include file='public/menu'}
<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span>
		{$controller}
		<span class="c-gray en">&gt;</span>
		{$action}
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="Hui-article">
		<article class="cl pd-20">
			<div class="text-c">
				<form action="{:url('admin/owner/owner_list')}" method="post">
				<span class="select-box inline">
				<select name="cond" class="select">
					<option value="all">全部分类</option>
					<option value="oname">户主</option>
					<option value="area">区域</option>
					<option value="vill">小区</option>
					<option value="status">状态</option>
				</select>
				</span>
				<input type="text" name="key" id="" placeholder=" 关键字" style="width:250px" class="input-text">
				<button name="" id="" class="btn btn-success radius" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜委托</button>
				</form>
			</div>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
				<!-- <a href="{:url('admin/owner/do_del')}" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> -->
				<a href="javascript:;" onclick="batchdel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
				<!-- <a class="btn btn-primary radius" href="{:url('admin/owner/owner_add')}"><i class="Hui-iconfont">&#xe600;</i> 添加委托</a> -->
				</span>
				<span class="r">共有数据：<strong>{$data|count}</strong> 条</span>
			</div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							<th><input name="" type="checkbox" value=""></th>
							<th>ID</th>
							<th>缩略图</th>
							<th>区域</th>
							<th>小区</th>
							<th>地址</th>
							<th>业主</th>
							<th>委托时间</th>
							<th>状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						{volist name="data" id="vo"}
						<tr class="text-c va-m">
							<td><input class="ck" name="" type="checkbox" value="{$vo.oid}"></td>
							<td>{$vo.oid}</td>
							<td><a onClick="product_show('哥本哈根橡木地板','product-show.html','10001')" href="javascript:;"><img width="60" class="product-thumb" src="/static/upload/owner/{$vo.thumb}"></a></td>
							<td>{$vo.area}</td>
							<td>{$vo.vill}</td>
							<td>{$vo.addr}</td>
							<td>{$vo.oname}</td>
							<td>{$vo.otime}</td>
							{assign name="stu" value="$vo.status"}
							{if condition="$vo.status=='待审核'"}
							<td class="td-status"><span class="label label-danger radius">{$vo.status}</span></td>
							{elseif condition="$vo.status=='待出租'"}
							<td class="td-status"><span class="label label-primary radius">{$vo.status}</span></td>
							{elseif condition="$vo.status=='已出租'"}
							<td class="td-status"><span class="label label-success radius">{$vo.status}</span></td>
							{else}
							<td class="td-status"><span class="label label-success radius">{$vo.status}</span></td>
							{/if}
							<td class="td-manage">
								{if condition="$stu=='待审核'"}
								<a style="text-decoration:none" class="ml-5" onClick="owner_edit(this,{$vo.oid})" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>								
								<a style="text-decoration:none" class="ml-5" onClick="owner_del(this,{$vo.oid})" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
								{/if}
							</td>
						</tr>
						{/volist}
					</tbody>
				</table>
			</div>
		</article>
	</div>
</section>

{include file='public/footer'}
<!--请在下方写此页面业务相关的脚本-->
{load href='/static/lib/My97DatePicker/4.8/WdatePicker.js'}
{load href='/static/lib/datatables/1.10.0/jquery.dataTables.min.js'}
{load href='/static/lib/laypage/1.2/laypage.js'}
{load href='/static/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js'}
<script type="text/javascript">
	//批量删除
	function batchdel(){
		var re = '';
		$('input[type=checkbox]:checked').each(function(){
			re += $(this).val()+',';
		})
		var data = 'oid='+re;
		$.post('{:url('admin/owner/do_del')}',data,function(res){
			console.log(res);
		})
		$('input[type=checkbox]:checked').parents("tr").remove();
		if(re == ''){
			layer.msg('未选中任何记录!',{icon:1,time:1000});
		}else{
			location.reload();
			layer.msg('批量删除成功!',{icon:1,time:1000});
		}
	}

	//单个编辑
	function owner_edit(obj,id){
		// layer_show('编辑管理员','{:url('admin/owner/owner_edit')}'+'?oid='+id,'550','500');
		layer.open({
		type: 2,
		area: ['550px', '500px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: '编辑管理员',
		content: '{:url('admin/owner/owner_edit')}'+'?oid='+id,
		end:function(){
			location.href = '{:url('admin/owner/owner_list')}'
		}
	});
	}

	//单个删除
	function owner_del(obj,id){
		layer.confirm('确认要删除吗？',{icon:3,title:'提示'},function(index){
			var data = 'oid='+id;
			$.post('{:url('admin/owner/do_del')}',data,function(res){
				console.log(res);
			})
			$(obj).parents("tr").remove();
			layer.msg('已删除!',{icon:1,time:1000});
		});
	}

	$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
	]
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>